//
//  AYSBaseNavigantonViewController.m
//  AiYingShiProject
//
//  Created by lanou on 15/10/28.
//  Copyright (c) 2015年 李晓理. All rights reserved.
//

#import "AYSBaseNavigantonViewController.h"

@interface AYSBaseNavigantonViewController ()


@end

@implementation AYSBaseNavigantonViewController

// 隐藏tabBarController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self)
    {
        self.hidesBottomBarWhenPushed = YES;
    }
    return self;
}

// 隐藏navigationController
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    _topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 65)];
    _topView.backgroundColor = [UIColor colorWithWhite:0.000 alpha:0.900];
    
    
    _backButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    _backButton.frame = CGRectMake(15, 30, 25, 25);
    [_backButton setBackgroundImage:[UIImage imageNamed:@"goback"] forState:(UIControlStateNormal)];
    [_backButton addTarget:self action:@selector(clickBackButton:) forControlEvents:(UIControlEventTouchUpInside)];
    [_topView addSubview:_backButton];
    
    _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(45, 30, SCREEN_WIDTH - 75, 30)];
    _titleLabel.textColor = [UIColor whiteColor];
    _titleLabel.font = [UIFont systemFontOfSize:20];
    [_topView addSubview:_titleLabel];
    [self.view addSubview:_topView];

}

// 点击button
- (void)clickBackButton:(UIButton *)button
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
